home *** CD-ROM | disk | FTP | other *** search
/ The Netherlands - A Compact World / The Netherlands.iso / chapters / 2.5.dxr / Internal_31_V2 tekstimport2 met MAC, MacChars, Edit, Tekstkleur EN LINKS!! (dubbel).ls < prev    next >
Encoding:
Text File  |  2004-06-10  |  4.2 KB  |  126 lines

  1. property spriteNum, pWoordenlijst
  2. global taalkeuze, maclist, tekstkleur, woordenteller
  3.  
  4. on vertalen me
  5.   sprite(spriteNum).visibility = 0
  6.   if tekstkleur = VOID then
  7.     sprite(spriteNum).member.foreColor = 235
  8.   else
  9.     sprite(spriteNum).member.foreColor = tekstkleur
  10.   end if
  11.   if taalkeuze = VOID then
  12.     taalkeuze = "nl"
  13.   end if
  14.   tekstpad = "@txt:" & taalkeuze & ":"
  15.   fieldnaam = sprite(spriteNum).member.name
  16.   bestandnaam = fieldnaam & ".txt"
  17.   pWoordenlijst = []
  18.   woordenteller = 1
  19.   buffer = new(xtra("fileio"))
  20.   openFile(buffer, tekstpad & bestandnaam, 1)
  21.   setPosition(buffer, 0)
  22.   bufferinhoud = readFile(buffer)
  23.   closeFile(buffer)
  24.   put bufferinhoud into member fieldnaam
  25.   repeat with Tellertje8 = 1 to member(fieldnaam).text.length
  26.     if member(fieldnaam).char[Tellertje8] = numToChar(10) then
  27.       put EMPTY into (member fieldnaam).char[Tellertje8]
  28.     end if
  29.     if member(fieldnaam).char[Tellertje8].charToNum > 127 then
  30.       if the platform contains "Mac" then
  31.         put numToChar(maclist[member(fieldnaam).char[Tellertje8].charToNum - 127]) into (member fieldnaam).char[Tellertje8]
  32.       end if
  33.     end if
  34.     if member(fieldnaam).char[Tellertje8] = "#" then
  35.       put EMPTY into (member fieldnaam).char[Tellertje8]
  36.       invoercharacter = EMPTY
  37.       linkbeschrijving = EMPTY
  38.       repeat while invoercharacter <> "|"
  39.         invoercharacter = member(fieldnaam).char[Tellertje8]
  40.         linkbeschrijving = linkbeschrijving & invoercharacter
  41.         put EMPTY into (member fieldnaam).char[Tellertje8]
  42.       end repeat
  43.       put EMPTY into linkbeschrijving.char[the length of linkbeschrijving]
  44.       startselectie = Tellertje8 + 2
  45.       repeat while invoercharacter <> "#"
  46.         Tellertje8 = Tellertje8 + 1
  47.         invoercharacter = member(fieldnaam).char[Tellertje8]
  48.         if member(fieldnaam).char[Tellertje8] = numToChar(10) then
  49.           put EMPTY into (member fieldnaam).char[Tellertje8]
  50.         end if
  51.         if member(fieldnaam).char[Tellertje8] = numToChar(32) then
  52.           woordenteller = woordenteller + 1
  53.         end if
  54.         if member(fieldnaam).char[Tellertje8].charToNum > 127 then
  55.           if the platform contains "Mac" then
  56.             put numToChar(maclist[member(fieldnaam).char[Tellertje8].charToNum - 127]) into (member fieldnaam).char[Tellertje8]
  57.           end if
  58.         end if
  59.       end repeat
  60.       eindeselectie = Tellertje8 - 1
  61.       put EMPTY into (member fieldnaam).char[Tellertje8]
  62.       link(me, startselectie, eindeselectie, linkbeschrijving, fieldnaam)
  63.     end if
  64.   end repeat
  65.   repeat with i = 1 to pWoordenlijst.count
  66.     if pWoordenlijst[i] <> 0 then
  67.       set the foreColor of word i of member fieldnaam to 214
  68.     end if
  69.   end repeat
  70.   sprite(spriteNum).visibility = 1
  71. end
  72.  
  73. on beginSprite me
  74.   sendSprite(spriteNum, #vertalen)
  75.   pass()
  76. end
  77.  
  78. on link me, start, eind, linkbeschrijving, fieldnaam
  79.   tijdelijkpunt = member(fieldnaam).charPosToLoc(start)
  80.   tijdelijkpunt.locH = tijdelijkpunt.locH + sprite(spriteNum).left
  81.   tijdelijkpunt.locV = tijdelijkpunt.locV + sprite(spriteNum).top
  82.   startwoord = sprite(spriteNum).pointToWord(tijdelijkpunt)
  83.   tijdelijkpunt = member(fieldnaam).charPosToLoc(eind)
  84.   tijdelijkpunt.locH = tijdelijkpunt.locH + sprite(spriteNum).left
  85.   tijdelijkpunt.locV = tijdelijkpunt.locV + sprite(spriteNum).top
  86.   eindwoord = sprite(spriteNum).pointToWord(tijdelijkpunt)
  87.   repeat with woord = startwoord to eindwoord
  88.     pWoordenlijst.addAt(woord, linkbeschrijving)
  89.   end repeat
  90. end
  91.  
  92. on mouseWithin me
  93.   staticmouseword = the mouseWord
  94.   if (staticmouseword <= pWoordenlijst.count) and (staticmouseword > 0) then
  95.     if pWoordenlijst[staticmouseword] <> 0 then
  96.       cursor(280)
  97.     else
  98.       cursor(-1)
  99.     end if
  100.   end if
  101. end
  102.  
  103. on mouseLeave me
  104.   cursor(-1)
  105. end
  106.  
  107. on mouseUp me
  108.   global naam
  109.   staticmouseword = the mouseWord
  110.   put the mouseWord
  111.   if (staticmouseword <= pWoordenlijst.count) and (staticmouseword > 0) then
  112.     if pWoordenlijst[staticmouseword] <> 0 then
  113.       if pWoordenlijst[staticmouseword].char[1] = "@" then
  114.         naam = pWoordenlijst[staticmouseword]
  115.         put EMPTY into naam.char[1]
  116.         tell the stage
  117.           wisseltje()
  118.         end tell
  119.       else
  120.         put pWoordenlijst[staticmouseword]
  121.         do(pWoordenlijst[staticmouseword])
  122.       end if
  123.     end if
  124.   end if
  125. end
  126.